import api from "../api/proj.js";

export default {
	state: {
		datDev: {},

		currDev: {}, //设备信息

	},
	getters: {


	},
	mutations: {
		hFlyToDev(state, code) {
			let u = state.scene3d;
			let devs = state.modDevs;
			for (var i = 0; i < devs.length; i++) {
				let dev = devs[i];
				if (dev.code == code) {
					u.FlyTo(dev.datId);
					return;
				}
			}
			console.log("定位失败，", code, devs);

		},
		hFlyToId(state, id) {
			let u = state.scene3d;
			u.FlyTo(id);
		},
		hBeginInitDat(state, d) {

		},
		hSetJhCfg(state, v) {
			let u = state.scene3d;

			let pv = {
				m_use: true,
				m_bName: 'yyc-ld',
				m_Pos: '{x:-178.5474,y:540.7927,z:747.6405}',
				m_Rot: '{x:37.00021,y:179,z:-1.399779e-05}'
			};
			u.OnCurentBuildPos(pv);

			u.SetScaleValue({
				enable: true,
				near: 5,
				far: 20000,
				rxMin: 5,
				rxMax: 85
			});
			u.SetBuild("");
			u.OnClickDbL = (d) => {
				console.log("双击对象", d);
			}
		},
		hDatApi(state, v) {

			state.datDev = v;

		},
		hCheckModState(state, v) {

		},
		hZzzxState(state, v) {

			state.datDev = v;
			console.log("状态数据", v);
		}
	},
	actions: {
		asyncInitDat(state, d) {
			state.commit("hBeginInitDat", '');
		 
		  
			// setTimeout(function() {
			// 	state.commit("hSetJhCfg", '');
			// }, 2000);
		}
	}
};
